<?php

include_once('../../php/postgre.php');
$ids = $_GET['ids'];
if (is_numeric($ids)) {  
	$ind= get_data("Select * from spm_kegiatan where id_kegiatan = '$ids'");
    $rw = get_data("SELECT COUNT(*) as cnt from spm_subkegiatan where id_kegiatan = '$ids'");
	$kdkeg = $ind['kode_kegiatan'];
    $vlue = $rw['cnt'] + 1;
    $kodesubkeg = ($vlue <= 9) ? "0" . $vlue : $vlue;
    $kd = $kdkeg . "." . $kodesubkeg;
    echo $kd;
}
?>